#include <opencv2/opencv.hpp>
#include <iostream>
#include <opencv2/imgproc.hpp>
using namespace std;
using namespace cv;

int main()
{
    Mat img = imread("../yuyan.png");
    if (!img.data)
    {
        cout << "请检查图像文件名称是否正确" << endl;
        return -1;
    }
    Mat img1, img2, img3, img4;
    Point2f center = Point2f(img.cols / 2, img.rows / 2); //极坐标在图像中的原点
                                                          //正极坐标变换
    // warpPolar(img, img1, Size(300, 600), center, center.x,
    //           INTER_LINEAR + WARP_POLAR_LINEAR);
    // //逆极坐标变换
    // warpPolar(img1, img2, Size(img.rows, img.cols), center, center.x,
    //           INTER_LINEAR + WARP_POLAR_LINEAR + WARP_INVERSE_MAP);

    // 对数极坐标变换
    warpPolar(img, img3, Size(300, 600), center, center.x,
              INTER_LINEAR + WARP_POLAR_LOG);
    // warpPolar(img3, img4, Size(img.rows, img.cols), center, center.x,
    //           INTER_LINEAR + WARP_POLAR_LOG + WARP_INVERSE_MAP);
    // imshow("Original image", img);
    // imshow("After transform", img1);
    // imshow("Reverse image", img2);
    imshow("LogPolar transform", img3);
    // imshow("LogPolar Reverse", img4);
    waitKey(0);
    return 0;
}